<?php
import 'menu.php';
require 'paxs.php';

$con=mysqli_connect("$pax_loc", "$pax_user", "$pax_pax","$pax_bd");
// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM terr");

echo "<table border='1'>
<tr>
<th>Tema</th>
<th>Link</th>
<th>Detalhes</th>
<th>Hora de insercao</th>
</tr>";

while($row = mysqli_fetch_array($result)) {
  echo "<tr>";
  echo "<td>" . $row['tema'] . "</td>";
  echo "<td>" . $row['link'] . "</td>";
  echo "<td>" . $row['detalhes'] . "</td>";
  echo "<td>" . $row['data'] . "</td>";
  echo "</tr>";
}

echo "</table>";
mysqli_close($con);
?>
<br><br>
<?php
$con=mysqli_connect("$pax_loc", "$pax_user", "$pax_pax","$pax_bd");
// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM terr");

$result = mysqli_query($con,"SELECT * FROM terr where tema='terr'");

echo "<table border='1'>
<tr>
<th>Tema</th>
<th>Link</th>
<th>Detalhes</th>
<th>Hora de insercao</th>
</tr>";

while($row = mysqli_fetch_array($result)) {
  echo "<tr>";
  echo "<td>" . $row['tema'] . "</td>";
  echo "<td><a href=\"" . $row['link'] . "\">". $row['link'] ."</td>";
  echo "<td>" . $row['detalhes'] . "</td>";
  echo "<td>" . $row['data'] . "</td>";
  echo "</tr>";
}

echo "</table>";
mysqli_close($con);
?> 